'''
A script that shows how to use TwistedSim's Call-Later feature.

@author: Hatem Oraby
'''

from twistedSim import simManager
import time

def foo(arg1, arg2 = "default arg"):
    print "Foo is saying: " + str(arg1) + " and had also received arg2 as: "\
            + str(arg2)

def printTime():
    print "The time now is: " + str(time.asctime())

if __name__ == '__main__':
    
    printTime()
    simManager.SimManager.callLater(50, printTime)
    
    simManager.SimManager.callLater(100, foo, "Hello", "A lovely argument")
    simManager.SimManager.callLater(150, foo, "Hello", arg2 ="Another lovely argument")
    
    simManager.SimManager.run()